﻿@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>
@model MyMVCDemo.Models.StudentEnrollmentViewModel

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Student</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.Student.FirstName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Student.FirstName)
            @Html.ValidationMessageFor(model => model.Student.FirstName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Student.LastName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Student.LastName)
            @Html.ValidationMessageFor(model => model.Student.LastName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Student.Age)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Student.Age)            
            @Html.ValidationMessageFor(model => model.Student.Age)
        </div>
        
        <div class="editor-field">
            @Html.ListBoxFor(m=>m.SelectCourse,Model.CourseList)                        
        </div>
        
        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>